import { useState } from "react";
function Dog() {
    let [isBarking,setIsBarking]=useState(false)
    let [isRunning,setIsRunning]=useState(false)
    const handleClick=()=>{
        setIsBarking(true)  
        setIsRunning(true)
        setTimeout(()=>{
            setIsBarking(false)  
        setIsRunning(false)
        },2000)
    }
    return(
        <div onClick={handleClick}>
            <div>Dog</div>
            <p>{isBarking&&'wangwangwang'}</p>
            <p>{isRunning&&'runrunrun'}</p>
        </div>
    )
    
}
export default Dog